<template>
  <div class="warp" v-if="imgurl!==''">
    <div class="pasn">让员工用支付宝扫一扫，添加为店员</div>
    <img :src="imgurl" class="imgs">
  </div>
</template>

<script>
  import store from '@/store/store'

  export default {
    computed: {
      companyId () {
        return store.state.companyId
      }
    },
    data () {
      return {
        imgurl: ''
      }
    },
    methods: {
      bindViewTap () {
        const url = '/pages/logs/index'
        this.mpvue.navigateTo({url})
      },
      clickHandle (ev) {
        // throw {message: 'custom test'}
      },
      getData () {
        const url = store.state.server + '/ewm/addmember'
        this.mpvue.request({
          url: url,
          data: {
            sjid: this.companyId
          },
          success: (res) => {
            const {qrCodeUrl} = res.data
            this.imgurl = qrCodeUrl
          },
          fail: (error) => {
            this.mpvue.alert({
              content: error.errorMessage
            })
          }
        })
      }
    },

    mounted () {
      // let app = getApp()
      this.getData()
    },
    onUnload () {
    }
  }
</script>

<style scoped lang="scss">
  @import "../../common/common";


  div {
    box-sizing: border-box;
  }

  .bs {
    margin: 10px 0;
  }

  .warp {
    display: flex;
    background-color: #f3f3f3;
    height: 100vh;
    width: 100vw;
    padding: 20px 15px;
    flex-direction: column;
    box-sizing: border-box;
    align-items: center;
    justify-content: center;

    .pasn {
      margin-bottom: 20px;
    }

    .imgs {
      width: 300px;
      height: 380px;
    }
  }
</style>
